package com.orange.quickback.demo2;

import com.orange.quickback.system.api.common.result.QBootResult;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "Quest")
@RestController
@RequestMapping("/Quest/")
public class QuestController {
    @Resource
    QuestServiceImpl questService;
    @GetMapping("/getAllQuests")
    public QBootResult getAllQuests() {
        return questService.getAllQuests();
    }
    @PostMapping("/getQuestsById")
    public QBootResult getQuestsById(@RequestParam String id){
        return questService.getQuestById(Long.valueOf(id));
    }
    @PostMapping("/saveQuest")
    public QBootResult saveQuest(@RequestBody Quest quest){
        return questService.saveQuest(quest);
    }
    @PostMapping("/saveQuests")
    public QBootResult saveQuests(@RequestBody List<Quest> quests){
        return questService.saveQuests(quests);
    }
    @PostMapping("/getQuestsByPage")
    public QBootResult getQuestsByPage(@RequestParam int page, @RequestParam int size){
        return questService.getQuestsByPage(page,size);
    }
    @PostMapping("/getQuestsByPageDesc")
    public QBootResult getQuestsByPageDesc(@RequestParam  int page,@RequestParam int size){
        return questService.getQuestsByPageDesc(page,size);
    }
    @PostMapping("/deleteQuestById")
    public QBootResult deleteQuestById(@RequestParam String id){
        return questService.deleteQuestById(Long.valueOf(id));
    }
    @PostMapping("/deleteQuest")
    public QBootResult deleteQuest(@RequestBody Quest quest){
        return questService.deleteQuest(quest);
    }
}
